<template>
	<view>
		<!-- 表格头部 -->
		<view class="flex alicen">
			<view v-if="str == ''" class="col00 fz24 w160 txtcen  breakword border1 bored  pt10 pb10 pl10 pr10 h80"
				:style="{ backgroundColor: bg }" v-for="(item,index) in hander_list" :key="index">
				<view>{{item.name}}</view>
				<view>{{item.text}}</view>
			</view>

			<view v-if="str == 'scroll'" class=" col00 fz24 w20b txtcen  breakword border1 bored h120"
				:style="{ backgroundColor: bg }" v-for="(item1,index1) in hander_list" :key="index1"
				:class="item1.text?'':'flex  alicen flexCenter' ">

				<view :class="item1.text?'bgff000 pt10 pb10  h33b colff ':'' ">{{item1.name}}</view>
				<view :class="item1.text?'bg0055ff pt10 pb10 h33b  colff ':'' ">{{item1.text}}</view>
			</view>
		</view>
		<!-- 表格内容 -->
		<view class="">
			<view v-if="str == '' " class="flex alicen" :style="{ backgroundColor: childbg }">
				<view class="col00 fz24 w160 txtcen  breakword border1 bored flexCenter pt10 pb10 pl10 pr10 h120">
					{{tableItem.provinceName||''}}
				</view>
				<view class="col00 fz24 w160 txtcen  breakword border1 bored flexCenter pt10 pb10 pl10 pr10 h120">
					{{tableItem.thisYearZyzPlan||''}}
				</view>
				<view class="col00 fz24 w160 txtcen  breakword border1 bored flexCenter pt10 pb10 pl10 pr10 h120">
					{{tableItem.majorName||''}}
				</view>
				<!-- 专业招生人数 -->
				<view class="col00 fz24 w160 txtcen  breakword border1 bored flexCenter pt10 pb10 pl10 pr10 h120">
					{{tableItem.thisYearMajorPlan||''}}
				</view>
				<view class="col00 fz24 w160 txtcen  breakword border1 bored flexCenter pt10 pb10 pl10 pr10 h120">
					{{tableItem.submitZyRate||''}}%
				</view>
				<view class="col00 fz24 w160 txtcen  breakword border1 bored flexCenter pt10 pb10 pl10 pr10 h120">
					{{tableItem.majorPm||''}}
				</view>
				<view class="col00 fz24 w160 txtcen  breakword border1 bored flexCenter pt10 pb10 pl10 pr10 h120">收藏
				</view>
			</view>
			<view v-if="str == 'scroll' " class="flex alicen w100b" :style="{ backgroundColor: childbg }">
				<view class="col00 fz24 w100b txtcen  breakword h180">
					<view class="w100b h33b" v-for="(item1,index1) in tableItem.yearsData" :key="index1">
						<view class="flex alicen h100b  w100b">
							<view class="h100b flexCenter bdr1_bottom bored w20b">{{item1.year||'--'}}</view>
							<view class=" border1 bored w20b h100b">
								<!-- 当年计划数 -->
								<view class=" bdr1_bottom col40 bored text-word-break-1">
									{{item1.majorPlan==9999?"":item1.majorPlan||'-'}}</view>
								<!-- 录取数 -->
								<view class="col359eff bdr1_bottom bored text-word-break-1">{{item1.admission||'-'}}
								</view>
							</view>
							<view class="w20b h100b bdl1-rigth1 bored">
								<!-- 录取最低分 -->
								<view class="bdr1_bottom  text-word-break-1 col40 bored">{{item1.minGradeStr}}</view>
								<!-- 录取最低分名次 -->
								<view class="col359eff bdr1_bottom bored text-word-break-1">{{item1.minGradeSeq}}</view>
							</view>

							<view class="w20b h100b bdl1-rigth1 bored">
								<!-- 同位分 -->
								<view class="bdr1_bottom col40 bored text-word-break-1">{{item1.seqGrade}}</view>
								<!-- 同位分名次 -->
								<view class="col359eff bdr1_bottom bored text-word-break-1">{{item1.seq}}</view>
							</view>
							<view class="w20b h100b bdl1-rigth1 bored">
								<!-- 录取平均分 -->
								<view class="bdr1_bottom col40 bored text-word-break-1">{{item1.avgGradeStr}}</view>
								<!-- 录取平均分名次 -->
								<view class="col359eff bdr1_bottom bored text-word-break-1">{{item1.avgGradeSeq}}</view>
							</view>
						</view>
					</view>
				</view>
				<view v-if="str == '' " @tap.stop="favorite(tableItem)"
					class="col00 fz24 w12b txtcen  breakword border1 bored flexCenter pt10 pb10 pl10 pr10 h160">
					收藏
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		props: {
			bg: {
				type: String,
				default: '#dae6fe'
			},
			childbg: {
				type: String,
				default: '#ffffff'
			},
			str: {
				type: String,
				default: ''
			},
			//表头
			hander_list: {
				type: Array,
				default: (() => {})
			},
			//表格
			tableItem: {
				type: Object,
				default: {}
			}
		},
		computed: {
			dynamicStyles() {
				return {
					backgroundColor: this.bg, // 初始背景色
				}
			}
		},
		methods: {
			//收藏事件
			async favorite(item) {
				let params = {
					schoolCode: item.scode,
					zyz: item.zyz,
					userId: this.readData('useId')
				}
				let favres = await this.request.get('/api/addMyFavorite', {
					params
				})
				if (favres.code == 200) {
					this.successToShow(favres.msg)
				}
			}
		}
	}
</script>
<style lang="scss">

</style>